<?php
/**
 * Ohlasky View for Ohlasky Component
 * @license		GNU/GPL
 */

// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view' );

/**
 * Ohlasky View
 *
 */
class OhlaskysViewOhlasky extends JView {
/**
 * display method of Ohlasky view
 * @return void
 **/
    function display($tpl = null) {
    //get the ohlasky
        $ohlasky =& $this->get('Data');
        $text = '';
        if (!empty($ohlasky)) {
            $jeToNova_ohl_bool = true;
            if (!empty($ohlasky->id)) {
                $jeToNova_ohl_bool = false;
            }
            if (!empty($ohlasky->misto_nazev)) {
                $text = ' místo: '.$ohlasky->misto_nazev;
            }
            if (!empty($ohlasky->datum_str)) {
                $text = $text.', datum: '.$ohlasky->datum_str;
            }
        }

        JToolBarHelper::title(   JText::_('Událost').' <small><small>'.$text.'</small></small>' );
        JToolBarHelper::save();
        if ($jeToNova_ohl_bool) {
            JToolBarHelper::cancel();
        } else {
        // for existing items the button is renamed `close`
            JToolBarHelper::deleteList();
            JToolBarHelper::cancel( 'cancel', 'Close' );
        }

        $this->assignRef('ohlasky',	$ohlasky);

        parent::display($tpl);
    }
}
